<template>
  <div class="swiper" v-show="swiper.length">
    <!-- 轮播 -->
    <swiper class="swiper" :options="swiperOption">
      <swiper-slide v-for="item in swiper" :key="item.bannerId">
        <a href="https://music.163.com/">
          <img class="swiper-img" :src="item.pic" />
        </a>
      </swiper-slide>
      <div class="swiper-pagination" slot="pagination"></div>
    </swiper>
  </div>
</template>

<script>
export default {
  props: { swiper: Array },
  data() {
    return {
      swiperOption: {
        autoplay: 2000,
        grabCursor: true,
        loop: true,
        // 当用户操作了轮播图后 是否停止 autoplay
        autoplayDisableOnInteraction: false,
        pagination: '.swiper-pagination'
      },
      type: 2
    }
  }
}
</script>

<style lang="stylus" scoped>
.swiper >>>.swiper-pagination-bullet-active
  background #FD6C62 !important
.swiper
  width 100%
  height 0
  overflow hidden
  padding-bottom 38.88%
  background rgb(231, 23, 23)
  // padding-top 8px
  .swiper-img
    width 100%
    background #eeeeee
    border-radius 2px
</style>
